#include <iostream>
#include "BitOperator.h"
//#include "stdafx.h"
#include "TestBackup.h"
#include "ComMemPool.h"
#include <windows.h>
#include <iostream>


#define TESTFUNCTIONNAME(X) add##X()

#undef 
typedef double NonoTestType;
using namespace std;

int addNONO()
{
	return 1;
};

int addBOBO()
{
	return 2;
};


void testBackup()
{
	CComMemPool<NonoTestType> memPool;
	int nTickOld = GetTickCount();
	NonoTestType* p[1000];
	for(int i = 0;i<10;i++)
	{
		for(int j=0;j<(100*i);j++)
		{
			p[j] = memPool.NewObject();
		}

		for(int j=0;j<(100*i);j++)
		{
			memPool.ReleaseOject(p[j]);
		}
	}
	int nNew = GetTickCount();
	cout<<"MemPool time Used: "<<nNew - nTickOld<<"\n";

	nTickOld = GetTickCount();
	for(int i = 0;i<10;i++)
	{
		for(int j=0;j<(100*i);j++)
		{
			p[j] = new NonoTestType;
		}

		for(int j=0;j<(100*i);j++)
		{
			delete p[j];
		}
	}
	nNew = GetTickCount();
	cout<<"New&Delete time Used: "<<nNew - nTickOld<<"\n";
	testBackup();

	cout<<int(unsigned int(-1)>>1);
	cout<<int (int(-1)>>1);

	testunion tunion;
	tunion.m_Level.m_short1 = 12;
	tunion.m_Level.m_short2 = 1;


	testunion tunion2;
	
	tunion2.m_S2.m_s1 = 22;
	tunion2.m_S2.m_2Char.m_c1 = 4;
	tunion2.m_S2.m_2Char.m_c2 = 5;

	int Uc;
	Uc = tunion.m_int;
	tunion.m_int = Uc +3;


	testcharunion tcUnion;
	tcUnion.half.first = 12;
	tcUnion.half.second2 = 0;
	tcUnion.half.second3 = 0;
	tcUnion.half.second4 = 0;
	//memcpy(&Uc,&tunion,sizeof(testunion));

	Testtt ttVec;

	ttVec.aa.push_back(1);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);
	ttVec.aa.push_back(2);

	int a = TESTFUNCTIONNAME(NONO);
	a = TESTFUNCTIONNAME(BOBO);


	int nOrder;//  = FourShortToInt(1,2,3,4);

	vector<short> List_Level,listSkillLevel;

	List_Level.push_back(1);
	List_Level.push_back(2);
	List_Level.push_back(3);
	List_Level.push_back(4);
	List_Level.push_back(5);
	List_Level.push_back(6);
	List_Level.push_back(7);
	List_Level.push_back(15);

	nOrder=SetMoundSkillLevel(List_Level);
	GetMoundSkillLevel(listSkillLevel,nOrder);

	vector<int> vecExec;
	//vector<int> vecExecReturn;

	vector<MoundSkillInfo> vecSkill,vecSkillReturn;
	vecSkill.push_back(MoundSkillInfo(2,3));
	SetMoundSeniorSkill(vecSkill,vecExec);
	GetMoundSeniorSkill(vecSkillReturn,vecExec);
	int c =abs1(2);
	c =abs1(-5);
	c= min1(1,2);
	c= min1(-1,2);
	c= max1(-1,2);
	c= max1(1,2);
	c = mid(1,2,6);
};